home *** CD-ROM | disk | FTP | other *** search
/ El Mac 1 / Magazine.iso / EL MAC 1 / Shareware / HyperCard / XCMD Docs / CompileIt! Source Code / SimpleForm(num,den) < prev    next >
Encoding:
Text File  |  1995-08-19  |  304 b   |  14 lines  |  [TEXT/ttxt]

  1. function SimpleForm num,den
  2.   put num*1 into x
  3.   put den*1 into y
  4.   if x>y then put y into z
  5.   else put x into z
  6.   repeat with n=z down to 2
  7.     if x mod n=0 and y mod n=0 then
  8.       put x div n into x
  9.       put y div n into y
  10.       exit repeat
  11.     end if
  12.   end repeat
  13.   return x & "/" & y
  14. end SimpleForm